#include <vector>
#include <algorithm>
#include<iostream>
using namespace std;
class Solution {
public:
    int findMinArrowShots(vector<vector<int>>& points) {
        int len = points.size();
        if (len < 2)
            return len;
        sort(points.begin(), points.end(), [](const vector<int>& left, const vector<int>& right) {
            return left[0] < right[0];
            });
        int start = -1, end = -1;
        int res = 0;
        for (int i = 0; i < len; ++i) {
            if (end < points[i][0]) {
                ++res;
                start = points[i][0];
                end = points[i][1];
            }
            else {
                start = points[i][0];
                end = min(end, points[i][1]);
            }
        }
        return res;
    }
};